*TABLE 1 Sum Stats* 
use  "/Table 1 and 3 data.dta"


*race*
tab race location if HASALL ==1, col
*edu
tab edu location if HASALL ==1, col 
*Age
sum age if location =="Ann Arbor" & HASALL ==1
sum age if location =="Detroit" & HASALL ==1

clear

*Table 2: Number of measures 
use "/Table 2 data.dta"

tab nofmeas if SampleType =="DBS" & HASDBS ==1
tab nofmeas if SampleType =="PBMC" & HASDBS ==1 
tab nofmeas if SampleType =="SALIVA" & HASDBS ==1

tab nofmeas if SampleType =="PBMC" & HASALL ==1 
tab nofmeas if SampleType =="SALIVA" & HASALL ==1

clear

*Table 3:CORRELATIONS AND SUM STATS FOR TL * 
use  "/Table 1 and 3 data.dta"

*correlations* 
corr  PBMC_TL Saliva_TL if HASALL == 1
corr  PBMC_TL Saliva_TL DBS_TL  if HASDBS == 1

*Sum Stats Between* 
sum PBMC_TL Saliva_TL  if HASALL == 1, detail 
sum PBMC_TL Saliva_TL DBS_TL  if HASDBS == 1, detail 

clear

*** TABLE 4, WITHIN PERSON VARIATION IN ln(TL Quant) and lb(36B4 Quant) *** 
use "/Table 4 data numerator.dta"

sum   TLvar if SampleType =="DBS" & HASDBS ==1 
sum   TLvar if SampleType =="PBMC" & HASDBS ==1 
sum   TLvar if SampleType =="SALIVA" & HASDBS ==1 

sum   TLvar if SampleType =="PBMC" & HASALL ==1 
sum   TLvar if SampleType =="SALIVA" & HASALL ==1 

clear

** 36B4 QUANT**
use "/Table 4 data denominator.dta"

sum   TLvar if SampleType =="DBS" & HASDBS ==1 
sum   TLvar if SampleType =="PBMC" & HASDBS ==1 
sum   TLvar if SampleType =="SALIVA" & HASDBS ==1 

sum   TLvar if SampleType =="PBMC" & HASALL ==1 
sum   TLvar if SampleType =="SALIVA" & HASALL ==1 

clear

*Table 5: 
use "/Table 5 data numerator.dta"

preserve 
keep if HASDBS ==1
sum NumMeas if SampleType =="DBS", detail 
sum NumMeas if SampleType =="PBMC", detail 
sum NumMeas if SampleType =="SALIVA", detail

restore  
keep if HASALL ==1
sum NumMeas if SampleType =="PBMC", detail 
sum NumMeas if SampleType =="SALIVA", detail

clear

**36B4 QUANT**
use "/Table 5 data denominator.dta"

preserve 
keep if HASDBS ==1

sum DenomMeas if SampleType =="DBS", detail 
sum DenomMeas if SampleType =="PBMC", detail 
sum DenomMeas if SampleType =="SALIVA", detail

restore  
keep if HASALL ==1

sum DenomMeas if SampleType =="PBMC", detail 
sum DenomMeas if SampleType =="SALIVA", detail

clear

*Figure 1 and 2
use  "/Figures data.dta"

*Plotting PBMC by other measures 
twoway lfit Saliva_TL PBMC_TL   || scatter Saliva_TL PBMC_TL  
keep if HASDBS == 1
twoway lfit  DBS_TL PBMC_TL || scatter  DBS_TL PBMC_TL

clear

***** TABLES 6 REGRESSIONS ****
use  "/Table 6 data.dta"
replace age = age/10

*For Saliva* 
sureg (Saliva_TL age location Black Latino HighSchool College) (PBMC_TL age location Black Latino HighSchool College) if HASALL == 1
test [#1]age = [#2]age
test [#1]location = [#2]location
test [#1]Black = [#2]Black
test [#1]Latino = [#2]Latino
test [#1]HighSchool = [#2]HighSchool
test [#1]College = [#2]College

gen Saliva_m_PBMC = Saliva_TL - PBMC_TL

reg Saliva_m_PBMC age location Black Latino HighSchool College if HASALL == 1
test age location Black Latino HighSchool College

*For DBS* 
sureg (DBS_TL age location Black Latino HighSchool College) (PBMC_TL age location Black Latino HighSchool College) if HASDBS == 1
test [#1]age = [#2]age
test [#1]location = [#2]location
test [#1]Black = [#2]Black
test [#1]Latino = [#2]Latino
test [#1]HighSchool = [#2]HighSchool
test [#1]College = [#2]College

gen DBS_m_PBMC = DBS_TL - PBMC_TL

reg DBS_m_PBMC age location Black Latino HighSchool College if HASDBS == 1
test age location Black Latino HighSchool College

clear
